﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="nelech.Views.Shared.Code" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	אתרים - נלך
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="left">
 
  <%Html.RenderAction("AdvertShowThree", "Advert", new { id = 7 });%>
 
</div>
<div id="main">
  <% var model = (Object[])this.Model;
       var lastPlace = (List<nelech.Models.DBModel.Place>)model[0];
       var recommended = (List<nelech.Models.DBModel.Place>)model[1];
     
       %>
    <h2>אתרים</h2>
 <div class="userForm">
            <% using (Html.BeginForm("Search", "Place"))
               { %>
            <fieldset>
                <legend>חיפוש מקום:</legend>
                
                <p>
                    <label for="area">
                        אזור:</label>
                    <%= Html.DropDownList("regeon", Utils.CreateRegeonListItems(21)) %>
                    <label for="season">
                       סוג האתר:</label>
                    <%= Html.DropDownList("type", Utils.CreateTypeListItems(1)) %>
                </p>
                <p>
                    <label for="difficulty">
                        בתשלום:</label>
                    <%= Html.DropDownList("cost", Utils.CreateCostListItems(1),null,null) %>
                    
                     </p>
                 <p><label for="searchString">חיפוש חופשי:</label>
                <%= Html.TextBox("searchString") %></p>
               <p class="floatleft">
                <input type="submit" value="חפש" /></p>
            </fieldset>
            <%} %>
        </div>
  <h3>אתרים מומלצים</h3>
   <% foreach (var item in recommended)
       { %>
    <fieldset class="recommended">
        <legend>

         <%= Html.ActionLink(item.name, "PlaceInfo" ,new { id = item.id })%>  
        </legend>
 <p class="floatright">
            <% if (item.Image.Count > 0)
               {

                   var images = item.Image.OrderBy(p => p.path);
                   var firstImage = images.First();
                   var smallImageName = System.IO.Path.GetFileName(firstImage.path.Replace("\\", "/"));
            %>
           <img  src="<%= "/Upload/Thumbs/" + smallImageName %>" alt="<%= firstImage.text %>" width="150px" />
            <% } %> </p><p>
            <%= Html.Encode(item.summary) %>
               </p><p>
            <span class="bold">מפת סימון שבילים: </span>
            <%= Html.Encode(item.Regeon1.id + " - " + item.Regeon1.text) %><br />
            <span class="bold">סוג המקום:</span>
            <%    foreach (var type in item.Type)
                  {
                      Response.Write(type.text + ", ");
                  }
             
            %></p>
            <p><%= Html.ActionLink("להרחבה", "PlaceInfo" ,new { id = item.id })%></p>
    </fieldset>
    <% } %>
    <h3>נוספו לאחרונה:</h3>
   <% foreach (var item in lastPlace)
       { %>
    <fieldset class="recommended">
        <legend>

           <%= Html.ActionLink(item.name, "PlaceInfo" ,new { id = item.id })%> 
        </legend>
 <p class="floatright">
            <% if (item.Image.Count > 0)
               {
                   var images = item.Image.OrderBy(p => p.path);
                   var firstImage = images.First();
                   var smallImageName = System.IO.Path.GetFileName(firstImage.path.Replace("\\", "/"));
            %>
           <img  src="<%= "/Upload/Thumbs/" + smallImageName %>" alt="<%= firstImage.text %>" width="150px" />
            <% } %> </p><p>
            <%= Html.Encode(item.summary) %>
               </p><p>
            <span class="bold">מפת סימון שבילים: </span>
            <%= Html.Encode(item.Regeon1.id + " - " + item.Regeon1.text) %><br />
            <span class="bold">סוג המקום:</span>
            <%    foreach (var type in item.Type)
                  {
                      Response.Write(type.text + ", ");
                  }
             
            %></p>
            <p><%= Html.ActionLink("להרחבה", "PlaceInfo" ,new { id = item.id })%></p>
    </fieldset>
    <% } %>
    <br />
    <%= Html.ActionLink("לרשימת כל האתרים", "AllList", "Home", new {id = 2 },null)%>
 </div>   
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="publishTop" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Right" runat="server">
</asp:Content>
